using System.Collections.Generic;
using UnityEngine;

public class GunList : MonoBehaviour
{
    public List<FileBullet> guns; //武器发射列表
    public int gunID = 0; //当前发射器ID
    void Awake()
    {
        foreach (Transform child in transform)
            if (child.name.StartsWith("gun")) guns.Add(child.GetComponent<FileBullet>());
    }

    public void SetGun(int id)
    {
        gunID = id;
        for (int i = 0; i < guns.Count; i++) guns[i].gameObject.SetActive(i == id);
    }
    public void OnFire()
    {
        // guns[gunID].Fire();
        BroadcastMessage("Fire");
    }
}
